package com.jinxin.platform.cdflowchart.service.impl;

import com.jinxin.platform.cdflowchart.pojo.domains.CdflowchartBeeTreeInfoDO;
import com.jinxin.platform.cdflowchart.mapper.CdflowchartBeeTreeMapper;
import com.jinxin.platform.cdflowchart.service.CdflowchartBeeTreeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 能耗树(CdflowchartBeeTree)表服务实现类
 *
 * @author cxiaojiang
 * @since 2021-10-13 09:38:52
 */
@Service
public class CdflowchartBeeTreeServiceImpl implements CdflowchartBeeTreeService {

    @Resource
    private CdflowchartBeeTreeMapper cdflowchartBeeTreeMapper;


    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public CdflowchartBeeTreeInfoDO queryById(String id) {
        return cdflowchartBeeTreeMapper.queryById(id);
    }

    @Override
    public List<CdflowchartBeeTreeInfoDO> queryAll(CdflowchartBeeTreeInfoDO cdflowchartBeeTreeInfoDO) {
        return cdflowchartBeeTreeMapper.queryAll(cdflowchartBeeTreeInfoDO);
    }

    @Override
    public int insertSomeOne(CdflowchartBeeTreeInfoDO cdflowchartBeeTreeInfoDO) {
        return cdflowchartBeeTreeMapper.insertSomeOne(cdflowchartBeeTreeInfoDO);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<CdflowchartBeeTreeInfoDO> queryAllByLimit(int offset, int limit) {
        return cdflowchartBeeTreeMapper.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param cdflowchartBeeTreeInfoDO 实例对象
     * @return 实例对象
     */
    @Override
    public CdflowchartBeeTreeInfoDO insert(CdflowchartBeeTreeInfoDO cdflowchartBeeTreeInfoDO) {
        cdflowchartBeeTreeMapper.insert(cdflowchartBeeTreeInfoDO);
        return cdflowchartBeeTreeInfoDO;
    }

    /**
     * 修改数据
     *
     * @param cdflowchartBeeTreeInfoDO 实例对象
     * @return 实例对象
     */
    @Override
    public CdflowchartBeeTreeInfoDO update(CdflowchartBeeTreeInfoDO cdflowchartBeeTreeInfoDO) {
        cdflowchartBeeTreeMapper.update(cdflowchartBeeTreeInfoDO);
        return queryById(cdflowchartBeeTreeInfoDO.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(String id) {
        return cdflowchartBeeTreeMapper.deleteById(id) > 0;
    }

    /**
     * 通过主键删除多条数据
     *
     * @param ids 主键
     * @return 是1否0成功
     */
    @Override
    public int deleteByIds(List<String> ids) {
        return cdflowchartBeeTreeMapper.deleteByIds(ids);
    }

}


